# encoding: utf-8
# -*- coding: utf-8 -*-

import sys

from datetime import datetime

from scripts.json_format.get_url import json_format_get
from scripts.json_format.clipboard import json_format_clipboard

if __name__ == "__main__":

    time_str = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    print(f'============ {time_str} ============\n')

    cmd = sys.argv[1]

    try:
        if cmd == 'json_format_get':
            json_format_get(sys.argv[2])

        if cmd == 'json_format_clipboard':
            json_format_clipboard()

    except ValueError as e:
        print(f"{cmd}: 捕获到异常: \n{e}\n")

    print(f'============================================\n')